home *** CD-ROM | disk | FTP | other *** search
/ ftp.mactech.com 2010 / ftp.mactech.com.tar / ftp.mactech.com / machack / Hacks97 / VerticalHold.sit / Vertical Hold / source code / NextMenus.c < prev    next >
Text File  |  1997-06-27  |  3KB  |  147 lines

  1. //    NextMenus.c
  2. //
  3. //    Copyright © 1997 Rob & Jon, MacHack '97
  4. //-------------------------------------------------------------------
  5.  
  6. #include "NextMenus.h"
  7.  
  8.  
  9. void drawHead( Str255 inTitle, Rect inRect )
  10. {
  11.     RGBColor    currColor;
  12.     Rect        currRect = inRect;
  13.  
  14.     // make sure that the pen is ducky
  15.     PenNormal();
  16.     
  17.     // draw the background, black
  18.     setForeColor( kBlack );
  19.     
  20.     PaintRect( &currRect );
  21.     
  22.     
  23.     // draw the outline; gray top, black & white bottom
  24.     setForeColor( kLtGray );
  25.     
  26.     MoveTo( inRect.left, inRect.bottom );
  27.     LineTo( inRect.left, inRect.top );
  28.     LineTo( inRect.right, inRect.top );
  29.     
  30.     MoveTo( inRect.right-1, inRect.top );
  31.     LineTo( inRect.right-1, inRect.bottom-1 );
  32.     LineTo( inRect.left, inRect.bottom-1 );
  33.     
  34.     setForeColor( kBlack );
  35.     
  36.     MoveTo( inRect.right, inRect.top+1 );
  37.     LineTo( inRect.right, inRect.bottom );
  38.     LineTo( inRect.left, inRect.bottom );
  39.     
  40.     // draw the text, white
  41.     setForeColor( kWhite );
  42.     
  43.     TextFont( helvetica );
  44.     TextFace( bold );
  45.     TextSize( 12 );
  46.     MoveTo(currRect.left+4, currRect.bottom-4);
  47.     
  48.     DrawString( inTitle );
  49.     
  50.     
  51.     PenNormal();
  52.  
  53. }// drawHead()
  54.  
  55.  
  56. void drawMenu( Str255 inTitle, char inCmdKey, Boolean inHasSub, Boolean inHilite, Rect inRect )
  57. {
  58.     RGBColor    currColor;
  59.     Point        triStart;
  60.     int            midV;
  61.  
  62.     // make sure that the pen is ducky
  63.     PenNormal();
  64.     
  65.     // draw the background, gray or white
  66.     if( inHilite )
  67.         setForeColor( kWhite );
  68.     else
  69.         setForeColor( kLtGray );
  70.  
  71.     PaintRect( &inRect );
  72.     
  73.     PenSize( 1, 1 );    
  74.     
  75.     // draw the outline; white top, black bottom
  76.     setForeColor( kWhite );
  77.     
  78.     MoveTo( inRect.left, inRect.bottom );
  79.     LineTo( inRect.left, inRect.top );
  80.     LineTo( inRect.right, inRect.top );
  81.     
  82.     setForeColor( kBlack );
  83.     
  84.     MoveTo( inRect.right, inRect.top+1 );
  85.     LineTo( inRect.right, inRect.bottom );
  86.     LineTo( inRect.left, inRect.bottom );
  87.     
  88.     
  89.     // draw the text, dark gray
  90.     setForeColor( kDkGray );
  91.     
  92.     TextFont( helvetica );
  93.     TextFace( normal );
  94.     TextSize( 12 );
  95.     MoveTo(inRect.left+4, inRect.bottom-3);
  96.     
  97.     DrawString( inTitle );
  98.     
  99.     // if there is no submenu and there is a cmd key, draw the cmd key
  100.     if( ! inHasSub )
  101.     {
  102.         if( inCmdKey != ' ' )
  103.         {
  104.             unsigned char    theCmd[3];
  105.             
  106.             theCmd[0] = 1;
  107.             theCmd[1] = inCmdKey;
  108.             MoveTo(inRect.right-15, inRect.bottom-3);
  109.             DrawString( theCmd );
  110.         }
  111.     }
  112.     else
  113.     {
  114.         // there is a submenu so draw the triangle
  115.         setForeColor( kDkGray );
  116.         
  117.         midV = inRect.top + ((inRect.bottom - inRect.top) / 2);
  118.         SetPt( &triStart, inRect.right-15, midV+3 );
  119.         
  120.         MoveTo( triStart.h, triStart.v);
  121.         LineTo( triStart.h, triStart.v-6 );
  122.         LineTo( triStart.h+6, triStart.v-3 );
  123.         setForeColor( kWhite );
  124.         LineTo( triStart.h, triStart.v );
  125.     }
  126.     
  127.     
  128.     PenNormal();
  129.  
  130. }// drawMenu()
  131.  
  132.  
  133. void setForeColor( short inColor )
  134. {
  135.     RGBColor    currColor;
  136.     
  137.     currColor.red   = inColor;
  138.     currColor.green = inColor;
  139.     currColor.blue  = inColor;
  140.     
  141.     RGBForeColor( &currColor );
  142.     
  143. }// setForeColor()
  144.  
  145.  
  146.  
  147.